<?php
class Control_AnnounceData_getViewData {

	function getViewData() {
		
		$fileName = MooForm::request('fileName');
		$nameKey = MooObj::get('Control_AnnounceData')->getNameKey($fileName);
		$tagInfo = MooForm::request('tagInfo');
		
		$filePath = ROOT_PATH . "/notices/" . $fileName;
		
		if(!MooFile::isExists($filePath)) {
			exit(0);
		}
		
		$data = array();
		while(false !== ($line = MooFile::readLine($filePath))) {
			if (!$line) {
				continue;
			}
			$tmpArr = array();
			$lineArr = explode('	', $line);
			$data[$lineArr[1]] = $lineArr;
		}
		
		$dataValues = array();
		foreach ($data as $k => $v) {
			if($v[0] == "id") {
				$index = 0;
			} else {
				$index = $v[0];
			}
			$dataValues[$index] = $v;
		}
			
		ksort($dataValues);
		
		unset($dataValues[0]);
		
		$res = "";
		foreach ($dataValues as $key => $val) {
			$res = $res . $val[2];
		}
		
		$res = str_replace("\n", "<br/>", $res);
		
//		MooView::set('nowGame', $nowGame);
//		MooView::set('nowPlatform', $selectArea);
//		MooView::set('nowLang', $selectLang);
		
		exit($res);
		// MooView::set('viewData', $res);
		// MooView::render('view');
	}
}